package com.example.demo.services.imp;

import com.example.demo.entity.Buy;
import com.example.demo.mapper.BuyMapper;
import com.example.demo.services.BuyService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BuyServiceImp implements BuyService {

    @Autowired
    private BuyMapper buyMapper;


    @Override
    public List<Buy> selectUserId(String id) {
        return buyMapper.selectUserId(id);
    }

    @Override
    public Integer insertBuy(Buy buy) {
        return buyMapper.insertBuy(buy);
    }

    @Override
    public List<Buy> selectAll() {
        return buyMapper.selectAll();
    }

    @Override
    public PageInfo<Buy> pageSelect(Integer page, Integer size) {
        PageHelper.startPage(page, size);
        List<Buy> list=buyMapper.selectAll();
        PageInfo<Buy> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
